package com.jt.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Accessors(chain = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SysResult {
    private Integer status; //状态码
    private String msg; //提示信息
    private Object data;    //返回的数据

    //失败时设置的状态
    public static SysResult fail(){
        return new SysResult(201,"服务器运行失败",null);
    }

    //成功时设置的
    public static SysResult success(){
        return new SysResult(200,"服务器运行成功",null);
    }

    //成功时设置且带返回值的
    public static SysResult success(Object data){
        return new SysResult(200,"服务器运行成功",data);
    }

    //成功时设置、带返回值且自定义提示信息的
    public static SysResult success(Object data,String msg){
        return new SysResult(200,msg,data);
    }
}
